The present invention relates generally to the field of electronic time-keeping, and, more particularly, to calibration of electronic clocks to correct for inaccuracies or drift.
Battery powered consumer electronics devices often use crystal oscillators. The accuracy of a conventional crystal oscillator may be characterized according to error contribution from environmental factors and/or inherent limitations of the crystal. For example, the accuracy of a Micro Crystal MC-306 32 kHz crystal may be characterized as follows:
Small deviations on the order of 1-5 ppm may also be introduced due to variations in the voltage applied to the crystal. Accordingly, inasmuch as 1 ppm equates to approximately 30 seconds per year, a crystal oscillator may be relatively accurate as a short-term time reference, but may exhibit a noticeable accumulated error if used for long-term time-keeping.
Several design approaches may be used to correct for deviations in crystal frequency. One relatively straightforward design approach to improving the accuracy of a crystal oscillator is to use higher quality components in the oscillator circuit (e.g., the crystal, trim capacitors, and voltage source). While this design approach may have the benefit of simplicity, it generally results in only incremental error improvements. More sophisticated circuit topologies may provide greater accuracy, but may also add complexity and cost to the time-keeping system.
A second design approach may be used in which the crystal oscillator provides a base reference signal. This base reference signal is used as an input signal for a digital counter. Overflow of the digital counter may be used as a clock signal that is used for time-keeping. The period between overflows, which corresponds to the period of the clock signal, may be controlled through an automatic reload (auto-reload) register that provides a starting value for the digital counter after the counter overflows. The auto-reload register is generally accessible by the system software and/or a hardware state machine. For example, if the digital counter is an up-counter, increasing the value in the auto-reload register decreases the clock signal period. Conversely, decreasing the value in the auto-reload register increases the clock signal period. The I2C Bus Serial Interface Real Time Clock (RS5C372A) Application Manual by Ricoh Corporation provides an exemplary implementation of the foregoing design approach in which a xe2x80x9ctime trimming registerxe2x80x9d is used to adjust the overflow period of a digital counter that is driven by a 32 kHz crystal oscillator.
Thus, by writing an appropriate value into an auto-reload register or time trimming register, inaccuracies in a crystal oscillator may be compensated for. Unfortunately, the value to be written into the auto-reload register or time trimming register is generally left to the user to determine. Consequently, there exists a need for improved time-keeping systems and related calibration methods.
Electronic clock calibration systems, methods, and computer program products may use a calibration reference signal to calibrate an electronic clock that generates an output signal and that is responsive to a base reference signal. The base reference signal is less accurate than the calibration reference signal and, therefore, has an actual frequency and an ideal frequency associated therewith. The difference between the actual frequency and the ideal frequency represents the inaccuracy of the base reference signal. The calibration reference signal may be used to determine this difference between the actual frequency and ideal frequency of the base reference signal. Once this difference is determined, the frequency of the electronic clock output signal may be adjusted to compensate for the inaccuracy of the base reference signal.
The base reference signal is often generated by a crystal oscillator circuit in consumer electronic devices, which is susceptible to frequency drift based on age, temperature, shock, and other environmental factors. Crystal oscillator circuits have an advantage in that they use relatively little power and, thus, tend to preserve battery life. Advantageously, the accuracy of a crystal oscillator circuit may be improved through use of a more accurate calibration reference signal that need not be available continuously.
The present invention may be embodied in a wireless terminal. In particular, a high accuracy base station clock signal may be used to calibrate an electronic clock in the wireless terminal. A crystal oscillator circuit in the wireless terminal may be used to provide the base reference signal, which drives the electronic clock.
In accordance with an aspect of the invention, the difference between the actual frequency of the base reference signal and the ideal frequency of the base reference signal may be determined by defining an ideal calibration interval, which is based on the ideal frequency of the base reference signal. An ideal number of cycles of the calibration reference signal may then be determined based on the frequency of the calibration reference signal and the length of the ideal calibration interval. An actual number of cycles of the calibration reference signal may also be determined using an actual calibration interval, which is based on the actual frequency of the base reference signal. The difference between the actual number of cycles of the calibration reference signal and the ideal number of cycles of the calibration reference signal may then be used to adjust the frequency of the electronic clock output signal.
In accordance with another aspect of the invention, the actual number of cycles of the calibration reference signal in the actual calibration interval may be determined by providing a counter that is responsive to the calibration reference signal and then reading the (counter value at the beginning and end of the actual calibration interval. The difference between the two counts corresponds to the actual number of cycles of the calibration reference signal in the actual calibration interval.
In accordance with still another aspect of the present invention, the difference between the actual number of cycles of the calibration reference signal and the ideal number of cycles of the calibration reference signal may be multiplied by a scaling factor to generate a calibration value, which is stored in a trim register that is associated with the electronic clock. The electronic clock may comprise a counter that is loaded with the calibration value in the trim register once per period of the electronic clock output signal (e.g., when the counter rolls over) to compensate for the inaccuracy of the base reference signal.
In accordance with yet another aspect of the invention, the ambient temperature may be recorded contemporaneously with the frequency adjustment of the electronic clock output signal. This allows the ambient temperature to be measured later to determine if a change in temperature has occurred since the electronic clock has been calibrated. If a temperature change has occurred, then the frequency of the electronic clock output signal may be adjusted based on the difference between the currently measured ambient temperature and the previously recorded ambient temperature.
Advantageously, electronic clock calibration systems, methods, and computer program products in accordance with the present invention may be implemented using conventional hardware and/or software components that may be provided in commercially available microcontroller systems. Moreover, the electronic calibration principles discussed herein may be used in any electronic device that includes an electronic clock that is derived from a relatively inaccurate base reference signal, but that has access to a more accurate calibration reference signal for one or more time intervals during which the electronic clock may be calibrated. Examples of such devices include cellular phones, hand-held calculators or personal digital assistants (PDAs), laptop computers, and electronic games.